package leetcode.秋招.好未来;

import java.util.Scanner;

/**
 * @author ：zsy
 * @date ：Created 2021/8/8 15:00
 * @description：
 */
public class Main1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        int k = in.nextInt();
        String[] s1 = s.split(",");
        StringBuilder builder = new StringBuilder();
        for (String s2 : s1) {
            builder.append(s2);
        }
        String string = builder.toString();
        int num = string.length() - k;
        builder = new StringBuilder(string.substring(num));
        builder.append(string.substring(0, num));
        int[] nums = new int[builder.toString().length()];
        for (int i = 0; i < builder.toString().length(); i++) {
            nums[i] = builder.toString().charAt(i) - '0';
            System.out.print(nums[i]);
            if (i != builder.toString().length() - 1) {
                System.out.print(",");
            }
        }

    }
}
